//导入
import React, { Component } from 'react';
import { Route, NavLink ,Redirect} from 'react-router-dom';
import PropTypes from 'prop-types';

import './Index.less'
import { NavConfiger, Navigator } from '../../navigator/Navigator';

import {Page1} from './Page1';
import {Page2} from './Page2';



class Index extends Component {

    rightClickHandle(){
        alert("你点击了导航条的rightItem!");
    }

    navConfig = {
        left: "返回",
        center: "默认的标题",
        right: <p onClick={this.rightClickHandle} >弹窗</p>,
        navClass: "nav_area_default"
    };


    render() {

        return (
            <NavConfiger>
                <fieldset className="page1" >
                    <legend>基本导航</legend>
                    <Navigator  navConfig={this.navConfig} />
                    <div className="content_box" >
                    <Route path={`${this.props.match.path}/page1`} component={Page1} />
                    <Route path={`${this.props.match.path}/page2`} component={Page2} />
                    <Redirect to={`${this.props.match.path}/page1`} />
                    </div>
                </fieldset>
            </NavConfiger>

        );
    }
}



export { Index };
